<template>
	<!-- 主题讨论 -->
    <page-body>
        <view class="page">
            <view class="flex benben-position-layout flex flex-wrap align-center flex_0_ibhf" :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
                <view class='flex flex-wrap align-center justify-between flex-sub fd0_0_ibhf'>
                    <view class='flex flex-wrap align-center fd0_0_c0_ibhf' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
                        <text class='fu-iconfont2  fd0_0_c0_c0_ibhf'>&#xE794;</text>
                    </view>
                    <view class='flex flex-wrap align-stretch justify-center'>
                        <text class='fd0_0_c1_c0_ibhf'>主题讨论</text>
                    </view>
                    <view class='flex flex-wrap align-center justify-end fd0_0_c0_ibhf'>
                    </view>
                </view>

            </view>
            <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
            <!---flex布局flex布局开始-->
            <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout flex_1_ibhf">
                <view class='flex flex-direction align-stretch fd1_0_ibhf'>
                    <view class='flex flex-wrap align-center fd1_0_c0_ibhf'>
                        <text class='fd1_0_c0_c0_ibhf'>主题讨论</text>
                        <view class='flex flex-wrap align-center fd1_0_c0_c1_ibhf'>
                            <text class='fd1_0_c0_c1_c0_ibhf'>{{status==0?'已结束':"进行中"}}</text>
                        </view>
                    </view>
                    <view class='flex flex-wrap align-center fd1_0_c1_ibhf'>
                        <text class='fd1_0_c1_c0_ibhf'>发布时间</text>
                        <text>{{time}}</text>
                    </view>
                    <view class='flex flex-wrap align-center' v-if="time1">
                        <text class='fd1_0_c1_c0_ibhf'>结束时间</text>
                        <text>{{time1}}</text>
                    </view>
                </view>
                <view class='flex flex-direction flex-wrap align-stretch fd1_1_ibhf' >
                    <view class='flex flex-wrap align-center fd1_0_c1_ibhf'>
                        <view class='flex flex-wrap align-center justify-center fd1_1_c0_c0_ibhf'>
                            <text class='fd1_1_c0_c0_c0_ibhf'>问</text>
                        </view>
                        <text>{{item.subject}}</text>
                    </view>
					<!-- 未参与 已结束 -->
					<view class="wzd" v-if="type==2&&status==0"> 未作答 </view>
                    <view class='flex flex-wrap align-center fd1_1_c1_ibhf' v-else>
                        <view class='flex flex-wrap fd1_1_c1_c0_ibhf'  v-if="type==2&&status==1">
							<!-- 未参与 进行中 -->
                            <benben-textarea class='flex input_fd1_1_c1_c0_ibhf' :placeholder="'请输入'" :adjust-position='true' :maxlength="240" :show-num='true' placeholder-style="color:#999;font-size:28rpx" v-model="answer" />
                            <!-- <template>
                                <view class='flex flex justify-end numberfd1_1_c1_c0_c0_ibhf'>
                                    <text>{{answer.length}}</text>
                                    <text>/</text>
                                    <text>240</text>
                                </view>
                            </template> -->
                        </view>
						<!-- 已参与  -->
						<view class='flex flex-wrap fd1_1_c1_c0_ibhf'  v-if="type==1">
							{{item.answer}}
						</view>
                    </view>
                </view>
            </view>

            <!---flex布局flex布局结束-->
			<view v-if="type==2&&status==1"	class="flex flex-direction flex-wrap align-center justify-center benben-position-layout flex list_flex_3_ibhf">
				<button class='list_fd3_0_ibhf' @tap.stop="tj">提交</button>
			
			</view>
			<view :style="{height: '88rpx'}"></view>

        </view>
    </page-body>
</template>
<script>
    export default {
        components: {},


        data() {
            return {
                "fd1_1_c1_c0": "",
				time:'',
				time1:'',
				type:1,//1已参与 2未参与
				list:[],
				teachin:'',//授课id
				course:'',//课程id
				status:'',//0已结束  1进行中
				answer:'',//参与输入的回答
				messid:'',//消息id
				item:{},
				topicdiscussion_id:'',//主题讨论id
				activity_id:'',//活动id
				isup:false,
            };
        },
        computed: {

        },
        watch: {},
        onLoad(options) {
			this.time=options.time
			this.time1=options.time1
			this.course=options.course
			this.type=options.type
			this.teachin=options.teachin
			this.status=options.status
			this.messid=options.aid
			this.topicdiscussion_id=options.topicdiscussion_id
			this.activity_id=options.activity_id
			this.getinfo()
            if (global.appTabBarType) this.toHomeDiy()
        },
        onUnload() {

        },
        onReady() {

        },
        onShow() {

        },
        onHide() {

        },
        onResize() {

        },
        onPullDownRefresh() {

        },
        onReachBottom(e) {

        },
        onPageScroll(e) {

        },
        methods: {
			// 公告 已读
			async getred(){
				let datalist = await this.$api.get(global.apiUrls.post68413be3159e9, {
					aid: this.messid,
					
				});
							
				// if (datalist.data.code != 1) {
				// 	this.$message.info(datalist.data.msg);
				// 	return
				// }
			},
			// 
			async getinfo(){
				
				let url=global.apiUrls.post692125fa4312a
			    let obj={
						aid:this.activity_id
				}
				if(this.type==1){
					url=global.apiUrls.post69212cac7e397
					obj={
						activitieslog_id:this.messid
					}
				}
				let res = await this.$api.get(url, obj);
							
				if (res.data.code != 1) {
					this.$message.info(res.data.msg);
					return
				}
				this.item=res.data.data
			},
			async tj(){
				if(!this.answer){
					this.$message.info('请输入回答')
					return
				}
				if(this.idup){
					return
				}
				this.isup=true
				let res = await this.$api.post(global.apiUrls.post66f52a0f82cf0, {
					activitieslog_id: this.messid,
					// topicdiscussion_id:this.topicdiscussion_id,
					answer:this.answer
				});
				// this.getred()		
				this.$message.info(res.data.msg);
				if (res.data.code != 1) {
					this.isup=false
					return
				}
				uni.navigateBack()
			}
        }
    };
</script>
<style lang="scss" scoped>
    .page {
        width: 100vw;
        overflow-x: hidden;
        min-height: calc(100vh - var(--window-bottom));
        background: rgba(245, 245, 245, 1);
        background-size: 100% auto;

        .flex_1_ibhf {
            padding: 24rpx;

            .fd1_0_ibhf {
                background: #FFFFFF;
                width: 702rpx;
                // height: 237rpx;
                border-radius: 16rpx;
                padding: 32rpx 24rpx 0rpx 24rpx;

                .fd1_0_c0_ibhf {
                    margin: 0rpx 0rpx 024rpx 0rpx;

                    .fd1_0_c0_c0_ibhf {
                        margin: 0rpx 30rpx 0rpx 0rpx;
                    }

                    .fd1_0_c0_c1_ibhf {
                        background: #F4F8FD;
                        width: 92rpx;
                        height: 40rpx;
						text-align: center;
                        .fd1_0_c0_c1_c0_ibhf {
                            color: rgba(28, 94, 252, 1);
							width: 100%;
                        }
                    }
                }
            }

            .fd1_1_ibhf {
                margin: 24rpx 0rpx 0rpx 0rpx;
                background: #FFFFFF;
                width: 702rpx;
                min-height: 300rpx;
                border-radius: 16rpx;
                padding: 32rpx 24rpx 32rpx 24rpx;
				.wzd{
					width: 654rpx;
					height: 80rpx;
					background: #F3F6F8;
					border-radius: 12rpx;
					text-align: center;
					line-height: 80rpx;
					color: #666666;
					font-size: 28rpx;
				}
                .fd1_1_c1_ibhf {
                    background: #F3F6F8;
                    width: 654rpx;
					padding: 24rpx;
                    // height: 272rpx;
                    border-radius: 16rpx;

                    .fd1_1_c1_c0_ibhf {
                        width: 100%;
                        border-radius: 10rpx 10rpx 10rpx 10rpx;
                        background: rgba(243, 246, 248, 1);
                        padding: 10rpx 10rpx 0rpx 16rpx;

                        .input_fd1_1_c1_c0_ibhf {
                            width: 100%;
                            height: 140rpx;
                            font-size: 28rpx;
                            font-weight: 400;
                            color: #333;
                            white-space: pre-wrap;
                        }

                        .numberfd1_1_c1_c0_c0_ibhf {
                            width: 100%;
                            font-size: 24rpx;
                            color: #FFFFFF;
                            line-height: 46rpx;
                            font-weight: 400;
                        }
                    }
                }
            }
        }

        .fd1_0_c1_ibhf {
            margin: 0rpx 0rpx 24rpx 0rpx;
        }

        .fd1_0_c1_c0_ibhf {
            margin: 0rpx 60rpx 0rpx 0rpx;
            font-size: 28rpx;
            color: rgba(153, 153, 153, 1);
        }

        .fd1_1_c0_c0_ibhf {
            background: #F4F8FD;
            width: 40rpx;
            height: 36rpx;
            margin: 0rpx 16rpx 0rpx 0rpx;

            .fd1_1_c0_c0_c0_ibhf {
                font-size: 24rpx;
                color: rgba(20, 94, 253, 1);
            }
        }

        .flex_0_ibhf {
            width: 750rpx;
            height: 88rpx;
            overflow: hidden;
            z-index: 10;
            top: 0rpx;
            background: #fff;
            background-size: 100% auto !important;

            .fd0_0_ibhf {
                padding: 0rpx 32rpx 0rpx 32rpx;

                .fd0_0_c1_c0_ibhf {
                    font-size: 36rpx;
                    font-weight: 700;
                    color: #333333;
                    line-height: 50rpx;
                }
            }
        }

        .fd0_0_c0_ibhf {
            width: 120rpx;

            .fd0_0_c0_c0_ibhf {
                font-size: 36rpx;
                color: #333;
            }
        }
    }
	.list_flex_3_ibhf {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(88rpx + var(--window-bottom));
	
		.list_fd3_0_ibhf {
			border-radius: 12rpx;
			width: 702rpx;
			line-height: 84rpx;
			font-size: 24rpx;
			background: #145EFD;
			color: #fff;
			height: 84rpx;
		}
	}
</style>